<script setup lang="ts">
import useDashboardStore from '@/store/dashboard/dashboard'
import { storeToRefs } from 'pinia'
import PieChart from './component/pie-chart.vue'
import MapChart from './component/map-chart.vue'
import Statistical from './component/statistical.vue'
import RoseChart from './component/rose-chart.vue'
import ColumnChart from './component/column-chart.vue'
import LineChart from './component/line-chart.vue'

// 1.获取商品总销量
const dashboardStore = useDashboardStore()
dashboardStore.getGoodsAmountListAction()
const { getGoodsAmountList } = storeToRefs(dashboardStore)
</script>

<template>
  <div class="dashboard">
    <el-row :gutter="20">
      <template v-for="(item, index) in getGoodsAmountList" :key="item.number1">
        <el-col :span="6"><Statistical v-bind="item" /></el-col>
      </template>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="7"><PieChart /></el-col>
      <el-col :span="10"><MapChart /></el-col>
      <el-col :span="7"><RoseChart /></el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="12"><LineChart /></el-col>
      <el-col :span="12"><ColumnChart /></el-col>
    </el-row>
  </div>
</template>

<style lang="less" scoped>
.dashboard {
  .el-col {
    margin-bottom: 20px;
  }
}
</style>
